<html>
<head>
<title>登录-${slogan}</title>
<meta http-equiv="content-type" content="text/html" charset="utf-8">
<#include "/common/css_js.html"/>
<link rel="stylesheet" type="text/css"
	href="${static}/css/login.css?v=${bv}?bv=${bv}">
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="col-md-4"></div>
			<div class="login">
				<div class="pub_title">招融宝后台管理系统</div>
				<form id="loginForm" class="validationEngine">
					<div class="form-group">
						<label for="name">账号</label> <input type="text"
							class="form-control validate[required]" id="name" name="name" placeholder="手机号或邮箱">
					</div>
					<div class="form-group">
						<label for="password">密码</label> <input type="password"
							class="form-control validate[required,custom[onlyLetterNumber],minSize[6]]" id="password" name="password"
							placeholder="密码">
					</div>
					<!-- <div class="form-group">
						<label for="password">验证码</label> <br /> <input type="password"
							class="form-control" id="password" name="password"
							placeholder="验证码" style="width: 55%; float: left;"> <img
							alt="" src="" style="width: 45%; float: right;">
					</div> -->
					<div class="clear"></div>
					<div class="checkbox">
						<label> <input type="checkbox" value="1" name="autoLogin"
							id="autoLogin">保持登录
						</label><br /> <a href="javascript:;" id="loginBtn"
							class="btn btn-primary" style="width: 320px;">登录</a><span><label
							id="tip"></label></span>
					</div>
				</form>

			</div>
			<div class="col-md-4"></div>
		</div>
	</div>
	<script type="text/javascript">
		$(function() {
			$("#loginBtn").bind("click", function() {
				var pass = $("#loginForm").validationEngine("validate");
				if(!pass){
					return;
				}
				var name = $("#name").val();
				var password = $("#password").val();
				var autoLogin = null;
				if ($("#autoLogin").is(":checked")) {
					autoLogin = 1;
				}
				var backUrl = "${backendUserHomeUrl}";
				post("${base}/dologin.html", {
					name : name,
					password : password,
					autoLogin : autoLogin
				}, function(data) {
					console.log(data);
					if (data.code == 1) {
						console.log("login succeed");
						window.parent.location = backUrl;
					} else if (data.code == 0) {
						$("#tip").text("用户名或密码错误");
					}
				});
			});
		});
	</script>
</body>
</html>
